#include "cccc_mod_atom.h"
#include <iostream>

ModularAtomic::ModularAtomic() {
	Fanins = new vector<ModularAtomic *> ();
	Fanouts = new vector<ModularAtomic *> ();
	violation = new vector<AViolation *> ();
	SteroType = "ModularAtomic";
}

ModularAtomic::ModularAtomic(string steroType, string moduleDef) {
	Fanins = new vector<ModularAtomic *> ();
	Fanouts = new vector<ModularAtomic *> ();
	violation = new vector<AViolation *> ();
	SteroType = steroType;
	ModuleDef = moduleDef;
//	cout << "stero type = " << SteroType << endl;
//	cout << "module def = " << ModuleDef << endl;
}

ModularAtomic::~ModularAtomic() {

}

string ModularAtomic::getModuleDef() {
	return ModuleDef;
}
void ModularAtomic::setModuleDef(string moduleDef) {
	ModuleDef = moduleDef;
}

string ModularAtomic::getSteroType() {
	return this->SteroType;
}

void ModularAtomic::printViolation() {
	for (int i = 0; i < violation->size(); i++) {
		AViolation * av = (*violation)[i];
		cout << av->toString() << "@ " << av->getLine() << endl;
	}
}

void ModularAtomic::setCOMPONENT(string comp) {
	this->COMPONENT = comp;
}
void ModularAtomic::setMODULE(string mod) {
	this->MODULE = mod;
}
void ModularAtomic::setSUBMODULE(string smod) {
	this->SUBMODULE = smod;
}

string ModularAtomic::getCOMPONENT() {
	return this->COMPONENT;
}
string ModularAtomic::getMODULE() {
	return this->MODULE;
}
string ModularAtomic::getSUBMODULE() {
	return this->SUBMODULE;
}

void ModularAtomic::addFanins(ModularAtomic * fanin) {
	this->Fanins->push_back(fanin);
}
void ModularAtomic::addFanouts(ModularAtomic * fanout) {
	this->Fanouts->push_back(fanout);
}

string ModularAtomic::getRelativePath() {
	return this->ModuleDef.substr(ROOT.length() , this->ModuleDef.length()  // J +1
			- ROOT.length() );												// J -1
}

void ModularAtomic::setRoot(string root) {
	this->ROOT = root;
}
//
void ModularAtomic::addViolation(AViolation * aviolation) {
	this->violation->push_back(aviolation);
}
